From a3af8b65000a0c9bb18e6bb0605a8533978c0425 Mon Sep 17 00:00:00 2001
From: Icenowy Zheng <icenowy@aosc.io>
Date: Sat, 23 Dec 2017 10:42:00 +0800
Subject: [PATCH 16/35] mfd: axp20x: add support for power key on AXP806

When AXP806 is working in "Self-work mode" (which means no other PMIC is
present), a power key can be connected to the EN/PWRON pin. In master or
slave mode the pin will work as EN and there's no power key, so nothing
will be triggered.

Add support for the power key on AXP806.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
---
 drivers/mfd/axp20x.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
index e94c72c..8980460 100644
--- a/drivers/mfd/axp20x.c
+++ b/drivers/mfd/axp20x.c
@@ -282,6 +282,20 @@ static struct resource axp803_pek_resources[] = {
 	},
 };
 
+static struct resource axp806_pek_resources[] = {
+	{
+		.name   = "PEK_DBR",
+		.start  = AXP806_IRQ_PWROK_RISE,
+		.end    = AXP806_IRQ_PWROK_RISE,
+		.flags  = IORESOURCE_IRQ,
+	}, {
+		.name   = "PEK_DBF",
+		.start  = AXP806_IRQ_PWROK_FALL,
+		.end    = AXP806_IRQ_PWROK_FALL,
+		.flags  = IORESOURCE_IRQ,
+	},
+};
+
 static struct resource axp809_pek_resources[] = {
 	{
 		.name   = "PEK_DBR",
@@ -857,6 +871,11 @@ static struct mfd_cell axp803_cells[] = {
 static struct mfd_cell axp806_cells[] = {
 	{
 		.id			= 2,
+		.name			= "axp221-pek",
+		.num_resources		= ARRAY_SIZE(axp806_pek_resources),
+		.resources		= axp806_pek_resources,
+	}, {
+		.id			= 2,
 		.name			= "axp20x-regulator",
 	},
 };
-- 
2.7.4

